Skip to content

Support IPPS printers that only offer older TLS cipher suites - #195628

Draft
brianegge wants to merge 11 commits into
home-assistant:devfrom
brianegge:ipp-tls-ciphers
Draft

brianegge wants to merge 11 commits into
home-assistant:devfrom
brianegge:ipp-tls-ciphers

Conversation

@brianegge

@brianegge brianegge commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Proposed change

IPP printers that only offer old TLS cipher suites can't be set up over IPPS, and the form only says "Failed to connect".

The Fuji Xerox DocuPrint CM315Z in #194928 offers only TLS_RSA_WITH_AES_{128,256}_CBC_SHA{,256} (RSA key exchange, no forward secrecy), and no newer firmware exists. Python's default client context offers none of these, so the printer ends every handshake with a handshake_failure alert. aioipp turned that into a plain IPPConnectionError, and the config flow showed the generic cannot_connect.

This PR:

  • Falls back to older cipher suites only when a printer needs them. The config flow (user, zeroconf and reconfigure) connects with the default context first. Only when the printer rejects the handshake, and "Verify SSL certificate" is off, does it retry with SSLCipherList.INTERMEDIATE (Mozilla's intermediate v4 profile, with SSL_ALPN_HTTP11 like the shared HTTP client). If that works, it stores legacy_tls: true on the entry (and on an existing entry for the same printer, if its stored port, path, SSL and verify settings match the endpoint that was checked), and the coordinator uses the intermediate profile only for such entries. Every other printer, including all existing entries, keeps the default context, so a printer that supports ECDHE but prefers static RSA isn't moved onto a suite without forward secrecy. The fallback is skipped with certificate verification on: there, a forged handshake failure from an on-path attacker could otherwise make the flow store the weaker profile, whereas without verification such an attacker could intercept the connection anyway. With verification on, a legacy-only printer gets tls_unsupported_verify_ssl, which explains that it can be set up with verification turned off. The intermediate profile still lists ECDHE suites first and does not include SSLCipherList.INSECURE. The contexts are the cached ones homeassistant.util.ssl creates at import, so nothing blocks the event loop.
  • Explains why a TLS handshake failed. aioipp now raises IPPConnectionTLSError (a subclass of IPPConnectionError) with OpenSSL's reason. The config flow maps the reason to a translated error: tls_unsupported (no common TLS version or cipher suite), tls_not_offered (the port doesn't speak TLS), tls_certificate (verification failed, e.g. a self-signed certificate), or tls_error otherwise. The user and reconfigure steps show it on the form, and the zeroconf step aborts with it. The raw OpenSSL reason is logged at debug level.
  • Bumps aioipp to 0.22.0, which provides both of the above.

Verified with OpenSSL 3.5 against an HTTPS IPP server limited to the printer's four suites over TLS 1.2. The default context fails with SSLV3_ALERT_HANDSHAKE_FAILURE. The intermediate context negotiates AES128-SHA and parses the printer attributes, which is the path the fallback takes.

Library changes 0.21.2 → 0.22.0: brianegge/aioipp@0.21.2...0.22.0
Release notes: https://github.com/brianegge/aioipp/releases/tag/0.22.0

The version bump and the integration change go together: the integration uses IPPConnectionTLSError and the ssl_context argument, which first ship in aioipp 0.22.0.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests (refactoring, typing, performance, etc.)
  • Developer tooling (CI, GitHub workflows, linters and checkers, scripts, AI instructions, code owners)

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

🤖 Generated with Claude Code

brianegge and others added 3 commits November 30, 2026 12:09
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI adaptive review requested due to automatic review settings November 30, 2026 17:10
@home-assistant

home-assistant Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

👋 Hi! Thanks for contributing to Home Assistant.

This is your PR dashboard which flags anything you need to address before your PR can be reviewed. Once everything is green, you can press the 'Ready for review' button at the bottom of the page to notify reviewers to take a look.

More information about this dashboard

This dashboard automatically updates on every change to this PR and reevaluates the rules as you go. Until everything has been addressed, the bot will keep the PR in draft.

Skip a check that doesn't apply

If you think a check doesn't apply to your PR (or the rule is bugged), comment @home-assistant ignore "<check name>" "<reason>". The check name as shown in the table above. This will mark the check as ignored and let you put your PR in 'Ready for review'; @home-assistant unignore "<check name>" restores the rule.

Bot commands

Reply with @home-assistant <command>. Several commands can be stacked, one per line:

  • update — Re-runs the bot's checks on the issue or pull request.
  • ignore — Waives a dashboard check: ignore "<check name>" "<reason>". (author) — e.g. @home-assistant ignore "Merge conflicts" "Broken rule, no merge conflicts present"
  • unignore — Restores a waived dashboard check: unignore "<check name>". (author) — e.g. @home-assistant unignore "Merge conflicts"
  • unassign — Removes the given integration domain's label and its code owners from the assignees. (author or code owners) — e.g. @home-assistant unassign "opensky"
  • close — Closes the issue or pull request. (code owners)
  • reopen — Reopens the issue or pull request. (code owners)
  • rename — Renames the issue or pull request: rename "<new title>". (code owners) — e.g. @home-assistant rename "A more descriptive title"
  • add-label — Adds a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the issue or pull request. (code owners) — e.g. @home-assistant add-label "needs-more-information"
  • remove-label — Removes a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) from the issue or pull request. (code owners) — e.g. @home-assistant remove-label "needs-more-information"
  • mark-draft — Marks the pull request as draft. (code owners)
  • update-branch — Updates the pull request branch with the base branch. (code owners)

Checks

✨ Everything's in order!

6 checks passed (7 skipped)
Status Check Details
✅ Forbidden files No forbidden files.
✅ Merge conflicts Merge status is being recalculated by GitHub.
✅ Merge target This PR targets dev.
✅ Type of change Type of change: bugfix
✅ PR title The title is clear.
✅ CLA Everyone involved has signed the CLA.
➖ New integration validation Not a new-integration PR.
➖ New platform validation No new platforms added.
➖ Config flow tests No new config flows added.
➖ Documentation Not a new integration or platform — no documentation PR required.
➖ Belongs together No pull requests listed.
➖ Code owner approval Touches no platinum integration — no code-owner approval required.
➖ Blocking: awaiting-frontend awaiting-frontend label not set — nothing to block.

@home-assistant home-assistant Bot added bugfix by-code-owner has-tests integration: ipp Quality Scale: No score Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage labels Nov 30, 2026
@home-assistant

Copy link
Copy Markdown
Contributor

Hey there @ctalkington, mind taking a look at this pull request as it has been labeled with an integration (ipp) you are listed as a code owner for? Thanks!

Code owner commands

Reply with @home-assistant <command>:

  • update — Re-runs the bot's checks on the issue or pull request.
  • ignore — Waives a dashboard check: ignore "<check name>" "<reason>". (author) — e.g. @home-assistant ignore "Merge conflicts" "Broken rule, no merge conflicts present"
  • unignore — Restores a waived dashboard check: unignore "<check name>". (author) — e.g. @home-assistant unignore "Merge conflicts"
  • unassign — Removes the given integration domain's label and its code owners from the assignees. (author or code owners) — e.g. @home-assistant unassign "opensky"
  • close — Closes the issue or pull request. (code owners)
  • reopen — Reopens the issue or pull request. (code owners)
  • rename — Renames the issue or pull request: rename "<new title>". (code owners) — e.g. @home-assistant rename "A more descriptive title"
  • add-label — Adds a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the issue or pull request. (code owners) — e.g. @home-assistant add-label "needs-more-information"
  • remove-label — Removes a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) from the issue or pull request. (code owners) — e.g. @home-assistant remove-label "needs-more-information"
  • mark-draft — Marks the pull request as draft. (code owners)
  • update-branch — Updates the pull request branch with the base branch. (code owners)

@home-assistant home-assistant Bot added the Top 50 Integration is ranked within the top 50 by usage label Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Check requirements

Checked at commit 0e929c7.

⚠️ Some checks require attention — see the details below.

Package Old New No Advisories Not Yanked Repo Public CI Upload Release Pipeline Security PR Link Async Safe
aioipp 0.21.2 0.22.0 ✅ ✅ ✅ ✅ ✅ ⚠️ ✅ ✅
📦 aioipp: 0.21.2 → 0.22.0

Generated by Check requirements (AW) · copilot · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 8.3K · history

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The TLS changes omit HTTP/1.1 ALPN negotiation, risking IPPS connection failures, and expose untranslated OpenSSL error codes in user-facing messages.

4 open issues
What changed in this PR

Updates the IPP integration to support IPPS printers with older TLS cipher suites and provide clearer TLS failure details, addressing #194928.

Changes:

  • Upgrades aioipp to 0.22.0.
  • Uses cached intermediate-cipher SSL contexts during setup and polling, respecting certificate-verification settings.
  • Adds TLS-specific flow errors and tests for error handling and SSL context selection.
File Description
tests/​components/​ipp/​test_init.py Tests coordinator SSL contexts with certificate verification enabled and disabled.
tests/​components/​ipp/​test_config_flow.py Tests TLS errors across flows and SSL context selection.
requirements_all.txt Updates the generated aioipp dependency pin.
homeassistant/​components/​ipp/​strings.json Adds TLS failure message templates.
homeassistant/​components/​ipp/​manifest.json Requires aioipp 0.22.0.
homeassistant/​components/​ipp/​coordinator.py Adds shared intermediate-cipher SSL context selection for polling.
homeassistant/​components/​ipp/​config_flow.py Uses the shared SSL contexts and handles TLS failures during setup, discovery, and reconfiguration.

Review effort: Max (adaptive)

Map OpenSSL's reason to tls_unsupported, tls_not_offered or
tls_certificate (tls_error otherwise) instead of showing the raw code,
and log the code at debug level. Use SSL_ALPN_HTTP11 like the shared
HTTP client. Config flow tests now finish the flow after an error and
assert the unique ID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI adaptive review requested due to automatic review settings November 30, 2026 18:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The TLS changes can silently weaken cipher security for already-compatible printers, while shared error messages can misdiagnose handshake failures and give discovery users instructions they cannot follow.

5 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve the existing cipher policy by default

homeassistant/​components/​ipp/​coordinator.py:44

Keep the existing cipher policy for printers that can already connect, and offer the legacy suites only when needed. A TLS 1.2 server can select its own preferred cipher regardless of the client ordering, so a printer supporting both ECDHE and static RSA may now choose RSA and lose forward secrecy even though it previously negotiated ECDHE. A default-first connection or explicit legacy opt-in would avoid silently weakening those connections.

2 resolved since last review

Review effort: Max (adaptive)

Zeroconf aborts can't show the connection form, so only the form errors
tell the user what to change. A handshake_failure alert can also come
from SNI or client-certificate requirements, so describe a version or
cipher mismatch as likely rather than certain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI adaptive review requested due to automatic review settings November 30, 2026 18:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Enabling legacy RSA ciphers by default can remove forward secrecy from existing IPPS connections when printers prefer static RSA, so compatibility should remain opt-in or follow an attempt with the default profile.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Avoid enabling legacy RSA ciphers in the default TLS profile

homeassistant/​components/​ipp/​coordinator.py:44

Keep legacy RSA ciphers opt-in or try the default profile before falling back to this one. TLS 1.2 servers can choose their own cipher order, so a printer that supports ECDHE but prefers AES128-SHA will negotiate static RSA without forward secrecy despite its lower position in the client list. This can affect existing IPPS setups, not just printers requiring the compatibility fallback.

4 resolved since last review

Review effort: Max (adaptive)

A TLS 1.2 printer may choose its own cipher order, so offering the
intermediate profile to every printer could move one that supports
ECDHE but prefers static RSA onto a suite without forward secrecy.

Connect with the default context first. Only when the printer rejects
the handshake, retry with the intermediate profile and record
legacy_tls on the entry; the coordinator uses the intermediate profile
only for those entries. Existing entries keep the default context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI adaptive review requested due to automatic review settings November 30, 2026 19:34
@brianegge

Copy link
Copy Markdown
Contributor Author

Re Copilot's point about offering the older suites to every printer: addressed in 73faf8f. The config flow now connects with the default context first and only retries with the intermediate profile when the printer rejects the handshake. It records legacy_tls on the entry, and the coordinator only uses the intermediate profile for those entries, so existing setups keep the default context.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An attacker-triggered TLS fallback can persist weaker ciphers without user confirmation, removing forward secrecy from subsequent connections.

3 open issues
1 resolved since last review

Review effort: Max (adaptive)

When the user or zeroconf step finds a configured printer that now
needs the older cipher suites, set legacy_tls along with the new host.
The flag is only ever turned on, which is safe: it is ignored without
TLS and the intermediate profile still prefers ECDHE. Expected
connection attempts in the TLS error tests are now a parameter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI adaptive review requested due to automatic review settings November 30, 2026 19:52
With verification on, a forged handshake failure from an on-path
attacker could make the flow store the weaker profile for a printer
that supports ECDHE. Without verification such an attacker could
intercept the connection anyway, so the fallback gives nothing away.
With verification on, a legacy-only printer now gets an error that
explains it can be set up with verification turned off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Legacy ciphers can be enabled by attacker-triggered handshake alerts or applied to a different stored endpoint, potentially removing forward secrecy through static RSA.

1 open issue
3 resolved since last review

Review effort: Max (adaptive)

Copilot AI adaptive review requested due to automatic review settings November 30, 2026 20:03
The duplicate-entry paths keep the stored port, path, TLS and
verification settings, so only set the flag when those match the
endpoint that needed the fallback. Otherwise the entry is left as it
was apart from the host, and the user can reconfigure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Protocol-version errors incorrectly trigger cipher-fallback behavior and misleading advice to disable certificate verification, while legacy-TLS reconfiguration lacks success and verification-blocked test coverage.

1 open issue
1 resolved since last review

Review effort: Max (adaptive)

Copilot AI adaptive review requested due to automatic review settings November 30, 2026 20:19
The intermediate profile does not allow older TLS versions, so only
cipher-related handshake failures are retried with it or answered with
the advice to turn verification off. Version errors keep the
tls_unsupported message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because rediscovery can change a known printer’s host without recording the TLS profile required for polling.

No open issues 🎉

1 resolved since last review

Review effort: Max (adaptive)

Copilot AI adaptive review requested due to automatic review settings November 30, 2026 20:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The TLS handling misclassifies INSUFFICIENT_SECURITY as a legacy-cipher issue, potentially prompting disabled certificate verification or weaker ciphers when the server requires stronger security.

1 open issue

Review effort: Max (adaptive)

That alert means the printer wants stronger suites, so neither the
retry nor the advice to turn verification off can help. It keeps the
tls_unsupported message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI adaptive review requested due to automatic review settings November 30, 2026 20:42

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix by-code-owner has-tests integration: ipp Quality Scale: No score Top 50 Integration is ranked within the top 50 by usage Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IPP - Failed to Connect with Fuji Xerox Printer CM315Z

2 participants